<?php
include 'connection.php';
require_once("PHPMailer/sendmail.php");
$to=$_POST['email'];
$token=time();
$email_result = mysql_query("select user_id from admin_user where email_id='".$to."'");
$row=mysql_fetch_row($email_result);
if($row!='')
{
$query = mysql_query("update admin_user set token='".$token."' where email_id='".$to."'");
$msg="Dear Admin <br/> Please click below link to reset your password <br/>";
$msg.="<a href='http://".$_SERVER['HTTP_HOST']."".str_replace("/reset.php","",$_SERVER['REQUEST_URI'])."/reset-password.php?token=".$token."&email=".base64_encode($to)."'>Reset Password link</a>";
if(sendMail($to,"Reset Password",$msg))
{
	echo "1";
}else
{
	echo "0";
}
}else{
echo "0";
}
?>